-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add missing zephyr,memory-region in STM32 dts & use LINKER_DT_NODE_REGION_NAME in LTDC for ext-sdram #95299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add missing zephyr,memory-region in STM32 dts & use LINKER_DT_NODE_REGION_NAME in LTDC for ext-sdram #95299
Conversation
000573c
to
6ad4729
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only potentially blocking point is indeed the wrong information concerning the occupancy of the SRAM. I don't know what tool is responsible for this summary, nor how it works, but it's a bit strange that it does not detect that it is the same RAM, and unless there is a way to write the device tree to avoid this, I'd say the problem lies on this tool.
Removing the labels and the compatibles specifically for these SRAMs just to avoid this prompt doesn't seem like a good solution since the SRAM selected as zephyr,sram
could be changed to another that has the label, and thus the problem would reappear.
I also agree that renaming the ext-sdram
property would be good but should be done in an ulterior PR.
The message is actually coming from the linker of the toolchain and is displayed when the following Zephyr option is set:
|
needs rebase :) |
6ad4729
to
651bd1b
Compare
Found an issue on the stm32l4r5.dtsi. Since the sram2 base is not the same as on stm32l4p5.dtsi, the memory-region naming was lost. Adding this in this intermediate push to make it visible to reviewers. |
Add the compatible zephyr,memory-region for all mmio-sram region which do not have yet that compatible as well as add the label to those regions. This allow to have a linker memory report which list all areas and also have all regions accessible via the linker script. Signed-off-by: Alain Volmat <[email protected]>
Use the LINKER_DT_NODE_REGION_NAME macro in order to get the memory-region into which to put the framebuffer for the LTDC. This is made possible since all memory areas have the zephyr,memory-region compatible, allowing to have each region referenced within the linker script generated by Zephyr. Signed-off-by: Alain Volmat <[email protected]>
SDRAM1 / SDRAM2 / PSRAM sections were being referenced in order to make them accessible for the framebuffer. This is now addressed via the mechanism provided by Zephyr hence this is no more necessary. Signed-off-by: Alain Volmat <[email protected]>
651bd1b
to
6f32b56
Compare
Simply rebased on top of main, with correction of the conflict in mp13.dtsi due to recent dtslint run on those files. |
|
And btw, the linker MEMORY section it parses is filled through the usage of |
This PR first goal is to introduce usage of the LINKER_DT_NODE_REGION_NAME within the STM32 LTDC driver in order to benefit from the Zephyr linker script generated based on zephyr,memory-region. With that done it is no more necessary to rely on STM32 specific linker scripts to select the area to store the framebuffer and simply point to the node of that memory using the ext-sdram property of the LTDC.
(btw, might want to change that property name, since this is not only SDRAM however maybe another PR, including migration-guide update might be better for that ...).
For this to work, regions to hold that framebuffer must have the right compatible in order to have Zephyr generate the linker-script properly. Looking within stm32 dtsi/dts files, I noticed that some were missing, especially for the STM32L4 for which I targetted that in the first place.
The first commit is thus adding the missing zephy,memory-region compatibles. While some are really necessary, I have doubt regarding some others. Since over the zephyr,sram is also pointing to such memory area, this leads also to cases where there is two lines printed in the print-memory-usage at the end of the build, such as below:
Above, the RAM and SRAM0 are actually the same region. Adding the zephyr,memory-region to SRAM0 makes it appears in the memory usage summary, and wrongly mentioned as usage is 0 while it is actually also RAM, hence 12.76% in the case above.
At the same time, the choice of having zephyr,sram pointing to the sram0 can vary (not always though) from a board / variant to another so it sounds like a good thing to have sram0 described as compatible zephyr,memory-region from within the .dtsi.
So, here a discussion point.
In a second commit, LTDC driver is updated to rely on the LINKER_DT_NODE_REGION_NAME macro to figure out the attribute to where store the framebuffer instead of STM32 specific hardcoded region names.
My understanding is that memc stm32 specific linker scripts were added for this purpose, so since LTDC do not need them anymore I removed them. If there were another usage for those linker scripts, then 3rd commit might not be needed.